@extends('mobile.layouts.default')
@section('title', '充值记录')

@section('content')
    <nav class="nav navbar-light w-100">
        <div class="container d-flex flex-row justify-content-between align-items-center">
            <div class="back-ico mr-2">
                <a class="fas fa-chevron-left" href="{{ route('recharge.record') }}"></a>
            </div>
            <div class="nav-title position-absolute w-100 text-center">
                <span>充值记录</span>
            </div>
            <div class="empty flex-grow-1"></div>
            <div class="header-user">
                <i class="fas fa-sync"></i>
            </div>
        </div>
    </nav>

    <div class="recharge-record-detail container">
        <div class="pay-header text-center mt-3">
            @if($order->is_pay == 1)
            <h2><small>￥</small>{{ $order->real_amount / 100 }}</h2>
            @else
            <h2><small>￥</small>{{ (thToRmb($order->total_amount) - ($order->credit_num / 100)) }}</h2>
            @endif

            @if($order->recharge_status == 2)
            <h6>交易成功</h6>
            @elseif($order->recharge_status == 4)
            <h6>交易失败</h6>
            @elseif($order->is_pay == 1 && $order->recharge_status == "" && $order->refund_status == "")
            <h6>待确认(请稍后刷新页面查看)</h6>
            @elseif($order->is_pay == 0)
            <h6>未支付</h6>
            @elseif($order->recharge_status == "" && $order->refund_status == 1)
            <h6>已退款</h6>
            @endif
        </div>
        <hr>
        <div class="pay-detail mt-3">
            <ul class="d-flex flex-column no-gutters p-0">
                <li>
                    <span>订单名称</span>
                    <b class="ensure-order">{{ $order->recharge_package->title }}</b>
                </li>
                <li>
                    <span>订单号</span>
                    <b class="ensure-order">{{ $order->payment_no }}</b>
                </li>
                <li>
                    <span>充值号码</span>
                    <b class="ensure-num">{{ show_user_num($order->cellphone) }}</b>
                </li>
                <li>
                    <span>运营商</span>
                    <b class="ensure-num">{{ \DB::table('operator')->where('id', $order->recharge_package->operator_id)->first()->name }}</b>
                </li>
                @if($order->is_pay == 1 && $order->credit_num > 0)
                <li>
                    <span>积分</span>
                    <b class="ensure-th">{{ $order->credit_num }}</b>
                </li>
                @elseif($order->is_pay == 0 && $order->credit_num > 0)
                <li>
                    <span>积分(未使用)</span>
                    <b class="ensure-th">{{ $order->credit_num }}</b>
                </li>
                @endif
                <li>
                    <span>交易金额</span>
                    <b class="ensure-th">{{ finance_format($order->total_amount) }}泰铢</b>
                </li>
                <li>
                    <span>交易时间</span>
                    <b class="ensure-num">{{ $order->created_at }}</b>
                </li>
                <li>
                    <span>交易汇率</span>
                    <b>{{ $order->exchange_rate }}</b>
                </li>
            </ul>
        </div>
        @if($order->recharge_extra)
        <div class="web-desc mt-3 p-2">
            <h6><b>备注：</b></h6>
            @if($order->recharge_extra == 'null')
            <p>号码：{{ show_user_num($order->cellphone) }}，充值成功。</p>
            @else
            <p>{{ $order->recharge_extra }}</p>
            @endif
        </div>
        @endif
    </div>

    @include('mobile.layouts.footer')

@stop

@push('page-css')
    <link rel="stylesheet" type="text/css" href="/assets/mobile/css/recharge.css">
@endpush

@push('page-js')
    <script src="/assets/mobile/js/ajax_load.js"></script>
    <script type="text/javascript">
        $('.fa-sync').click(function() {
            window.location.reload();
        })
    </script>
@endpush
